﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;

namespace Gallery.Account
{
    public partial class Login : System.Web.UI.Page
    {
        private static string adminUserName = WebConfigurationManager.AppSettings["AdminUser"].ToString();
        private static string adminPassword = WebConfigurationManager.AppSettings["AdminPassword"].ToString();

        protected void Page_Load(object sender, EventArgs e)
        {
            Session["IsAdmin"] = false;
        }

        protected void LoginButton_Click(object sender, EventArgs e)
        {
            if ((UserName.Text.ToUpper() == adminUserName.ToUpper()) && (Password.Text == adminPassword))
            {
                Session["IsAdmin"] = 1;
                Response.Redirect("Pictures.aspx", true);
            }
            else
            {
                FailureText.Text = "User name or password is not valid!";
            }
        }
    }
}
